home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / gaw110.zip / GAW.FX < prev    next >
Text File  |  1992-06-27  |  67KB  |  1,662 lines

  1. M
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                           _G_e_n_e_t_i_c _A_l_g_o_r_i_t_h_m _W_o_r_k_b_e_n_c_h _D_o_c_u_m_e_n_t_a_t_i_o_n
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18. J            _T_h_e _G_e_n_e_t_i_c _A_l_g_o_r_i_t_h_m _W_o_r_k_b_e_n_c_h _p_r_o_g_r_a_m _a_n_d _i_t_s _d_o_c_u_m_e_n_t_a_t_i_o_n _a_r_e  _c_o_p_y_-
  19.             _r_i_g_h_t  _a_n_d  _m_a_y  _n_o_t _b_e _c_o_p_i_e_d _o_r _d_i_s_t_r_i_b_u_t_e_d _w_i_t_h_o_u_t _w_r_i_t_t_e_n _p_e_r_m_i_s_s_i_o_n
  20.             _f_r_o_m _t_h_e _a_u_t_h_o_r _w_i_t_h _t_h_e _f_o_l_l_o_w_i_n_g _e_x_c_e_p_t_i_o_n_s:
  21.  
  22. J            (_1)  _C_o_p_i_e_s _o_f _t_h_e _s_o_f_t_w_a_r_e _a_n_d  _t_h_i_s  _d_o_c_u_m_e_n_t_a_t_i_o_n  _m_a_y  _b_e  _m_a_d_e  _a_n_d
  23.                  _p_a_s_s_e_d  _o_n  _t_o  _a_n_y  _t_h_i_r_d _p_a_r_t_y _p_r_o_v_i_d_e_d _t_h_a_t _a_l_l _t_h_e _f_i_l_e_s _o_n _t_h_e
  24.                  _d_i_s_t_r_i_b_u_t_i_o_n _d_i_s_k _a_r_e _d_i_s_t_r_i_b_u_t_e_d _t_o_g_e_t_h_e_r _i_n _u_n_m_o_d_i_f_i_e_d _f_o_r_m,  _a_n_d
  25.                  _p_r_o_v_i_d_i_n_g _t_h_a_t _n_o _p_r_o_f_i_t _i_s _m_a_d_e _f_r_o_m _s_u_c_h _d_i_s_t_r_i_b_u_t_i_o_n.
  26.  
  27. J            (_2)  _A _r_e_a_s_o_n_a_b_l_e _n_u_m_b_e_r _o_f _c_o_p_i_e_s _m_a_y _b_e _m_a_d_e _o_f _t_h_e _s_o_f_t_w_a_r_e  _f_o_r  _t_h_e
  28.                  _p_u_r_p_o_s_e  _o_f  _a_r_c_h_i_v_i_n_g  _t_o  _g_u_a_r_d _a_g_a_i_n_s_t _c_o_r_r_u_p_t_i_o_n _o_f _t_h_e _w_o_r_k_i_n_g
  29.                  _c_o_p_y _o_f _t_h_e _s_o_f_t_w_a_r_e.
  30.  
  31. J            _T_h_e _s_o_f_t_w_a_r_e _c_a_n _b_e _u_s_e_d _w_i_t_h_o_u_t _r_e_s_t_r_i_c_t_i_o_n _o_r  _p_a_y_m_e_n_t,  _b_u_t  _y_o_u  _a_r_e
  32.             _e_n_c_o_u_r_a_g_e_d _t_o _s_e_n_d _a_n _a_p_p_r_o_p_r_i_a_t_e _c_o_n_t_r_i_b_u_t_i_o_n _i_n _s_t_e_r_l_i_n_g _t_o _t_h_e _a_u_t_h_o_r
  33.             _i_f _y_o_u _f_e_e_l _t_h_a_t _t_h_e _p_r_o_g_r_a_m _h_a_s _b_e_e_n _o_f _u_s_e.  _S_e_e  _s_e_c_t_i_o_n  _4  _f_o_r  _t_h_e
  34.             _a_u_t_h_o_r'_s _a_d_d_r_e_s_s.
  35.  
  36. J            _N_o _w_a_r_r_a_n_t_y _i_s _g_i_v_e_n _t_h_a_t _t_h_i_s _s_o_f_t_w_a_r_e _i_s _f_i_t _f_o_r _a_n_y _p_u_r_p_o_s_e, _n_o_r _t_h_a_t
  37.             _i_t  _w_i_l_l  _p_e_r_f_o_r_m  _a_s  _d_e_s_c_r_i_b_e_d _i_n _t_h_i_s _m_a_n_u_a_l.  _Y_o_u _u_s_e _i_t _e_n_t_i_r_e_l_y _a_t
  38.             _y_o_u_r _o_w_n _r_i_s_k.
  39.  
  40.  
  41.  
  42.  
  43. J                _C_o_p_y_r_i_g_h_t (_C) _M_a_r_k _H_u_g_h_e_s _1_9_8_9. _A_l_l _r_i_g_h_t_s _r_e_s_e_r_v_e_d.
  44.  
  45.                 _L_a_s_t _C_h_a_n_g_e:  _3_0 _N_o_v_e_m_b_e_r _1_9_8_9.
  46. J
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.             _C_O_N_T_E_N_T_S
  71.  
  72. J                1.      Introduction
  73.  
  74.                 2.      Purpose
  75.  
  76.                 3.      Using the Genetic Algorithm Workbench Program
  77.  
  78.                         3.1     Hardware Requirements
  79.                         3.2     Running the Program
  80.                         3.3     Screen Display
  81.                         3.4     Menu Commands
  82.                         3.5     Program Control Variables
  83.  
  84.                 4.      Bibliography
  85.  
  86.                 5.      Appendix A -   Workbench Algorithms
  87.  
  88.                         5.1     Solving Problems with a Genetic Algorithm
  89.                         5.2     Genetic Coding
  90.                         5.3     Genetic Algorithm Implementation
  91.                         5.4     Summary of Algorithm Input Variables
  92.  
  93.                                 5.4.1   Population
  94.                                 5.4.2   Fitness Scaling
  95.                                 5.4.3   Breeder Selection
  96.                                 5.4.4   Generation Gap
  97.                                 5.4.5   Mates Selection
  98.                                 5.4.6   Mating
  99.                                 5.4.7   Crossover
  100.                                 5.4.8   Mutation Probability
  101.                                 5.4.9   Dispersal
  102.                                 5.4.10  Crowding Factor
  103.                                 5.4.11  Elitism
  104.                                 5.4.12  Sacrifice Selection
  105.  
  106.                         5.5     Output Variables
  107.                         5.6     References
  108.  
  109.                 6.      Appendix B -   A Typical Session Using the Workbench
  110.  
  111.                 7.      Appendix C -   Problems and How to Fix Them
  112.  
  113.                 8.      Appendix D -   General Introduction to Genetic Algorithms
  114.  
  115.                 9.      Appendix E -   Main Command Menu
  116.  
  117.  
  118.  
  119.  
  120. J
  121.  
  122.                                                G1
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.             H_1.  _I_n_t_r_o_d_u_c_t_i_o_n
  135.  
  136. J            This is a user's manual for the Genetic Algorithm Workbench  program
  137.             which  is  an  interactive  tool for demonstrating and experimenting
  138.             with genetic algorithms using an IBM compatible  personal  computer.
  139.             This is not a set of subroutines for inclusion in your own programs.
  140.             If that is what you require, see the  bibliography  for  details  of
  141.             GENESIS.
  142.  
  143. J            The manual commences with a description of the purpose of the  Work-
  144.             bench in section 2.
  145.  
  146. J            Section 3 then describes how to use the program and gives details of
  147.             hardware  requirements, instructions for running the program, an ex-
  148.             planation of the screen display, and explains  how  to  control  the
  149.             program using the command menu and program control variables.
  150.  
  151. J            Section 4 contains a short bibliography.
  152.  
  153. J            Appendix A describes the detailed operation of the genetic algorithm
  154.             employed  by  the  Workbench  and the effect of each algorithm input
  155.             variable.  It gives details of where  to  find  further  information
  156.             about  the  theory of the different aspects of the genetic algorithm
  157.             which  are  described.   An  explanation  of  each  output  variable
  158.             displayed on the screen is also given.
  159.  
  160. J            Appendix B contains a short step by step example of using the  Work-
  161.             bench.
  162.  
  163. J            Appendix C may help if you encounter  problems  trying  to  use  the
  164.             Workbench.
  165.  
  166. J            Appendix D includes an article as a general introduction to  genetic
  167.             algorithms and their applications.
  168.  
  169. J            Appendix E is a brief summary of the Workbench command menu.
  170.  
  171.  
  172.             _2.  _P_u_r_p_o_s_e
  173.  
  174. J            The purpose of the Workbench program  is  to  allow  experimentation
  175.             with search and optimisation algorithms.  It is primarily a tool for
  176.             experimenting with different types of genetic algorithm, but is also
  177.             intended  for  use  in comparing genetic algorithms with other tech-
  178.             niques although so far only the genetic algorithm  has  been  imple-
  179.             mented.
  180.  
  181.  
  182.                                                G2
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.             HA genetic algorithm is a method for finding the peaks  of  difficult
  195.             functions,  and  the  Workbench  program  is  both for demonstrating
  196.             genetic algorithms and for evaluating their performance.
  197.  
  198. J            The idea is that you provide a function, the "Target  Function"  and
  199.             see  how  quickly  the  selected  algorithm is able to find the peak
  200.             value, or indeed if it succeeds at all.  You can vary the details of
  201.             the  algorithm  used  by tweaking several numeric control parameters
  202.             and selecting different types of operator employed by the algorithm.
  203.  
  204.  
  205.             _3.  _U_s_i_n_g _t_h_e _G_e_n_e_t_i_c _A_l_g_o_r_i_t_h_m _W_o_r_k_b_e_n_c_h _P_r_o_g_r_a_m
  206.  
  207. J            The following sections describe hardware required  and  provide  in-
  208.             structions  for  starting the Workbench program.  The screen display
  209.             is then explained followed by details of how to control the program,
  210.             and finally a description of menu commands is given.
  211.  
  212. J            Appendix B describes a typical session using the Workbench, and will
  213.             also be useful while learning how to use the program.
  214.  
  215.  
  216.             _3._1.  _H_a_r_d_w_a_r_e _R_e_q_u_i_r_e_m_e_n_t_s
  217.  
  218. J            To run the genetic algorithm Workbench, you require
  219.  
  220. J                IBM PC/XT/AT or compatible
  221.                 EGA display
  222.                 Microsoft compatible mouse
  223. J
  224. J            The Workbench has been tested on MS-DOS version 3.3 but should  work
  225.             on  most  versions  of  MS-DOS and PC-DOS.  Reports of problems with
  226.             other versions will be appreciated.
  227.  
  228. J            The program will work on a VGA mode screen, but unless you  can  put
  229.             it  in  EGA  emulation mode, the program will only use the lower two
  230.             thirds of the screen, giving a squashed display.
  231.  
  232.  
  233.             _3._2.  _R_u_n_n_i_n_g _t_h_e _P_r_o_g_r_a_m
  234.  
  235. J            Check that your system hardware is suitable for running the  genetic
  236.             algorithm workbench (see above).
  237.  
  238. J            Switch on the computer and wait for your MS-DOS prompt to appear  on
  239.             the  screen.   If  you have a display adapter board that can emulate
  240.             several display modes, ensure that it is in EGA mode.  This might be
  241.  
  242. J                                               G3
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.             Hdone  by setting configuration switches on the adapter card prior to
  255.             switching your computer on, or by means of a special command provid-
  256.             ed  with your display adapter.  Refer to your display adapter manual
  257.             for details of how to set it to EGA mode.
  258.  
  259. J            Now, ensure that your mouse driver is loaded.   On  some  systems  a
  260.             command  such as "MOUSE" is provided to load the driver, on others a
  261.             command must be inserted into your config.sys file.   Refer  to  the
  262.             documentation for your mouse on how to install the mouse driver.
  263.  
  264. J            Now the final test.  Insert the  Genetic  Algorithm  Workbench  disk
  265.             into drive a: and type
  266.  
  267. J                a:gaw
  268. J
  269. J            and press the <ENTER> key.
  270.  
  271. J            The program takes a little while  to  load  but  you  should  see  a
  272.             display similar to that shown in figure 1 (see next section), and if
  273.             you move your mouse, the mouse cursor should  be  visible  and  will
  274.             change as you move it over different areas of the screen.
  275.  
  276. J            If you don't think everything is as described here, refer to  appen-
  277.             dix C which describes possible problems and how to deal with them.
  278.  
  279.  
  280.             _3._3.  _S_c_r_e_e_n _D_i_s_p_l_a_y
  281.  
  282. J            Figure 1 shows a screen display similar to the one  you  should  see
  283.             when  the  Workbench  is  first  started.   The main features of the
  284.             display are as follows.
  285.  
  286. J            _C_o_m_m_a_n_d _M_e_n_u
  287.                  This is a menu of commands shown at the top left of the  screen
  288.                  which   are   activated  using  the  mouse.   Each  command  is
  289.                  highlighted when the mouse cursor overlays it, and is  executed
  290.                  if  the  left  mouse  button  is  pressed  while the command is
  291.                  highlighted.  See section 3.5, Program Control for  details  of
  292.                  these commands.
  293.  
  294. J            _A_l_g_o_r_i_t_h_m _C_o_n_t_r_o_l _C_h_a_p_t_e_r
  295.                  This is the large box which spans the top of the screen to  the
  296.                  right  of  the command menu.  It is called a _c_h_a_p_t_e_r because it
  297.                  can contain several _p_a_g_e_s, only one of which is visible at  one
  298.                  time.  Initially, it displays a page called "Simple Genetic Al-
  299.                  gorithm" which shows a number  of  input  variables  and  their
  300.                  values,  which  are used to control the operation of this algo-
  301.  
  302. J                                               G4
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.                  Hrithm.  Pages can be flipped through, forwards or backwards, by
  315.                  clicking  the  left mouse button on the arrows in the top right
  316.                  hand corner of the chapter.  Each page is described below.
  317.  
  318. J            _S_i_m_p_l_e _G_e_n_e_t_i_c _A_l_g_o_r_i_t_h_m _P_a_g_e
  319.                  This is the box within the algorithm control  chapter  entitled
  320.                  "Simple  Genetic Algorithm".  (Note that it may be necessary to
  321.                  select this page using the mouse before it is displayed  within
  322.                  the  chapter box - see "Algorithm Control Chapter" above.) This
  323.                  page is normally displayed when the Workbench is first  started
  324.                  and  lists  a number of control inputs to the genetic algorithm
  325.                  together with their current values.  The page shows two columns
  326.                  of  input variables.  Each variable displayed shows its name to
  327.                  the left, a pair of arrows in the middle,  and  the  variable's
  328.                  current  value  to  the  right.  Note that many of the variable
  329.                  values are text strings.  You can alter the  value  of  any  of
  330.                  these  variables by clicking the left mouse button on the up or
  331.                  down arrows to the left of each value.   The  meaning  of  each
  332.                  variable is described in appendix A.
  333.  
  334. J            _G_e_n_e_r_a_l _P_r_o_g_r_a_m _C_o_n_t_r_o_l _V_a_r_i_a_b_l_e_s _P_a_g_e
  335.                  This is the box within the algorithm control  chapter  entitled
  336.                  "General  Program  Control  Variables".   (Note  that it may be
  337.                  necessary to select this page using  the  mouse  before  it  is
  338.                  displayed  within  the  chapter  box  -  see "Algorithm Control
  339.                  Chapter" above.) This page contains variables related  to  gen-
  340.                  eral  program  operation rather than a specific algorithm.  The
  341.                  meaning of each program control variable is described  in  sec-
  342.                  tion 3.5.
  343.  
  344. J            _O_u_t_p_u_t _V_a_r_i_a_b_l_e_s _B_o_x
  345.                  This is the box at the bottom right of the  screen  which  con-
  346.                  tains  the  current values of a number of variables relating to
  347.                  the current algorithm.  These variables cannot  be  altered  by
  348.                  the  user;  they  indicate  the current state of the algorithm.
  349.                  Each output variable is described in appendix A.
  350.  
  351. J            _T_a_r_g_e_t _F_u_n_c_t_i_o_n _G_r_a_p_h
  352.                  This is the graph labelled "Target Function" and  is  used  for
  353.                  entry  and  display  of  the  function to be solved.  Using the
  354.                  Workbench involves drawing functions on this  graph  which  are
  355.                  then solved using the selected algorithm.  After a function has
  356.                  been provided, a small red triangle on the  x  axis  marks  the
  357.                  highest peak, which is the target for the algorithm to find.
  358.  
  359. J            _P_o_p_u_l_a_t_i_o_n _D_i_s_t_r_i_b_u_t_i_o_n _H_i_s_t_o_g_r_a_m
  360.                  This is the plot entitled "Population Distribution" immediately
  361.                  below  the  target function graph and shows the distribution of
  362.                  organisms by value of x for the genetic algorithm.
  363.  
  364.  
  365.                                                G5
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.             H_O_u_t_p_u_t _G_r_a_p_h
  378.                  This is the graph labelled "Output Plot" and is used to display
  379.                  plots of various output variables against time.
  380.  
  381. J            _A_x_i_s _V_a_l_u_e _B_o_x
  382.                  This box labelled axis value is used in  combination  with  the
  383.                  mouse  cursor  to  read values from any of the graphs described
  384.                  above.  When the mouse cursor is moved over the  plot  area  of
  385.                  any graph, it changes to a cross hair and causes the Axis Value
  386.                  box to display the coordinate values of the corresponding graph
  387.                  at the point indicated by the cross hair.
  388.  
  389. J
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.                             _F_i_g_u_r_e _1 - _E_x_a_m_p_l_e _S_c_r_e_e_n _D_i_s_p_l_a_y
  406. J
  407.  
  408.             _3._4.  _M_e_n_u _C_o_m_m_a_n_d_s
  409.  
  410. J            The program is controlled entirely through use of a mouse.  General com-
  411.             mands  such as starting and stopping the algorithm are invoked through a
  412.             menu.  The target function is input by drawing the function on  a  graph
  413.             using  the mouse cursor, and algorithm and program control variables can
  414.             be altered by clicking the mouse over the up and down arrows to the left
  415.             of each value.
  416.  
  417. J            This section describes each menu command.  Program control variables are
  418.             explained in the following section.
  419.  
  420. J            The functions of the command menu shown in the top left  of  the  screen
  421.             are as follows:
  422.  
  423.  
  424. JJ
  425.  
  426.                                                G6
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.             H_R_e_d_r_a_w
  439.                  Redraws the whole screen.
  440.  
  441. J            _S_t_a_r_t _A_l_g/_S_t_o_p _A_l_g
  442.                  Start/pause algorithm operation.  Note that an algorithm  can  only
  443.                  be run if it the algorithm chapter is showing the corresponding al-
  444.                  gorithm page.  No algorithm can run while the chapter is displaying
  445.                  the page relating to general program control variables.
  446.  
  447. J            _S_t_e_p _A_l_g
  448.                  No function.  Currently unimplemented.
  449.  
  450. J            _R_e_s_e_t _A_l_g
  451.                  Resets algorithm ready for a run.  See the  relevant  appendix  for
  452.                  details of reseting an algorithm.
  453.  
  454. J            _P_l_o_t _D_a_t_a
  455.                  Plots currently selected data (see description of "Plot data" vari-
  456.                  able  later), on the output plot.  This displays the selected vari-
  457.                  able against time for the duration of the current algorithm run.
  458.  
  459. J            _P_l_o_t _T_a_r_g
  460.                  Re-plot the target function.  After redrawing the entire screen the
  461.                  target  function graph is cleared.  This command allows the current
  462.                  target function to be redrawn, but note that it will have no effect
  463.                  until  a  function  has been entered using the "Enter Targ" command
  464.                  described next.
  465.  
  466. J            _E_n_t_e_r _T_a_r_g
  467.                  Enter or re-enter target function.  After executing  this  command,
  468.                  the  mouse  cursor is moved to the target function graph allowing a
  469.                  target function to be drawn.  Clicking with the left  mouse  button
  470.                  plots a point for the function, and clicking with the right deletes
  471.                  a point.  You should draw a function which spans the full width  of
  472.                  the  x  axis from left to right and uses as few points as possible.
  473.                  Functions with many points slow down the algorithms.  When you  are
  474.                  happy  with  the  function, press both left and right mouse buttons
  475.                  together.
  476.  
  477. J            _Q_u_i_t Exit the program.
  478.  
  479. J            _T_e_s_t Tests my jump-up menus (no function).  Play by all means, but  this
  480.                  has nothing to do with the Workbench program.
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.                                                G7
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.             H_3._5.  _P_r_o_g_r_a_m _C_o_n_t_r_o_l _V_a_r_i_a_b_l_e_s
  500.  
  501. J            The program control variables are shown on the  page  labelled  "General
  502.             Program  Control  Variables".  The meaning of each program control vari-
  503.             able explained below.  (Algorithm control variables are explained in ap-
  504.             pendix A.)
  505.  
  506. J            Program control variable meanings:
  507.  
  508. J            _P_l_o_t _d_a_t_a
  509.                  This variable is used to determine the source of data for  plotting
  510.                  on  the graph entitled "Output Plot".  The selections available in-
  511.                  clude values (but not all values) of output  variables  from  those
  512.                  displayed in the "Output Variables" box.
  513.  
  514. J            _O/_P _P_l_o_t _X-_m_a_x
  515.                  This variable sets scale of the output plot X axis  by  fixing  the
  516.                  maximum x value that can be displayed.
  517.  
  518. J            _O/_P _P_l_o_t _Y-_m_a_x
  519.                  This variable sets scale of the output plot Y axis  by  fixing  the
  520.                  maximum y value that can be displayed.
  521.  
  522. J            _P_l_o_t _p_e_r_i_o_d
  523.                  This variable determines the frequency with  which  the  population
  524.                  distribution  histogram  is updated.  A value of 1 causes an update
  525.                  for every iteration (or generation) of the algorithm.  A value of 2
  526.                  causes update every other iteration, 3 every third and so on.
  527.  
  528. J            _R_a_n_d_o_m # _s_e_e_d
  529.                  This value is used to seed the program's  random  number  generator
  530.                  each time the algorithm is reset from the command menu.
  531.  
  532.  
  533.             _4.  _B_i_b_l_i_o_g_r_a_p_h_y
  534.  
  535. J            This section lists some sources of information about genetic algorithms.
  536.  
  537. J            A brief and very general introduction to genetic algorithms is given  in
  538.             appendix D which contains a copy of an article from The Guardian newspa-
  539.             per.
  540.  
  541. J            The following text is a  comprehensive  textbook  of  genetic  algorithm
  542.             theory and applications up to the year 1989.
  543.  
  544. JJ
  545.  
  546.                                                G8
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.                  HGoldberg, D. E. (1989). _G_e_n_e_t_i_c _A_l_g_o_r_i_t_h_m_s _i_n _S_e_a_r_c_h _O_p_t_i_m_i_z_a_t_i_o_n &
  559.                  _M_a_c_h_i_n_e _L_e_a_r_n_i_n_g. Addison-Wesley.
  560.  
  561. J            Users wishing to experiment with genetic algorithms in  their  own  pro-
  562.             grams  may  be interested in a package called GENESIS.  This is a set of
  563.             very useful subroutines written in C and built into a tool  for  experi-
  564.             menting  with  different  "flavours"  of algorithm.  GENESIS is far more
  565.             flexible than the Workbench but is not interactive and has no  graphical
  566.             output  built  in.  As an integrated tool, GENESIS will run on most Unix
  567.             systems, but the genetic algorithm subroutines are easily ported to  any
  568.             system with a standard C compiler.  GENESIS can be obtained from its au-
  569.             thor:
  570.  
  571. J                John J. Grefenstette,
  572.                 Navy Center for Applied Research in Artificial Intelligence,
  573.                 Naval Research Laboratory, Washington, D.C. 20375-5000.
  574.                 USA.
  575. J
  576. J            The author of the Workbench program  is  happy  to  correspond  with
  577.             users  interested  in learning more about genetic algorithms, or who
  578.             wish to discuss their relevance to a particular kind of problem.  He
  579.             can be reached by writing to the following address:
  580.  
  581. J                Mark Hughes,
  582.                 256 Milton Road,
  583.                 Cambridge,
  584.                 CB4 1LQ.
  585.                 UK.
  586.  
  587.                 Internet: mrh@camcon.co.uk
  588. J
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.                                                G9
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.             H_5.  _A_p_p_e_n_d_i_x _A - _W_o_r_k_b_e_n_c_h _A_l_g_o_r_i_t_h_m_s
  621.  
  622. J            This appendix describes the implementation of the genetic  algorithm
  623.             and operators used in the Workbench program.
  624.  
  625.  
  626.             _5._1.  _S_o_l_v_i_n_g _P_r_o_b_l_e_m_s _w_i_t_h _a _G_e_n_e_t_i_c _A_l_g_o_r_i_t_h_m
  627.  
  628. J            A genetic algorithm evolves solutions to a problem  through  natural
  629.             selection, breeding and genetic variation.  This involves generating
  630.             a population of solutions, measuring their suitability  or  fitness,
  631.             selecting the better solutions for breeding which produces a new po-
  632.             pulation.  The process is  repeated  and  gradually  the  population
  633.             evolves towards the solution.
  634.  
  635. J            In the genetic algorithm Workbench, the problem is to find the value
  636.             of  x  for  which  the  target function has a maximum value of f(x).
  637.             Each individual in the population  represents  a  solution  to  this
  638.             problem  in the form of a candidate value for x.  The suitability or
  639.             fitness of the individual is simply taken by calculating  the  value
  640.             of f(x) for the individual.  This leads to an individual whose value
  641.             of x corresponds to a high value of f(x) being  fitter,  and  conse-
  642.             quently being given a greater chance of breeding, than an individual
  643.             whose value of x corresponds to a lower value of f(x).
  644.  
  645.  
  646.             _5._2.  _G_e_n_o_t_y_p_e _C_o_d_i_n_g
  647.  
  648. J            In the same way that the genetic information of animals is coded  as
  649.             a  string (of DNA), the genetic information of each individual, i.e.
  650.             its value of x, is also coded as a string.  In this case as a string
  651.             of  zeros  or ones which can be interpreted as a simple binary code.
  652.             The choice of a string representation is deliberate because  it  al-
  653.             lows  processes which act on strings of DNA during natural evolution
  654.             to be implemented by the computer version of the genetic algorithm.
  655.  
  656. J            The string coding of each individual is known  as  its  genotype  in
  657.             biological  terminology, while its interpretation, i.e. its value of
  658.             x, is referred to as its phenotype.
  659.  
  660.  
  661.             _5._3.  _G_e_n_e_t_i_c _A_l_g_o_r_i_t_h_m _I_m_p_l_e_m_e_n_t_a_t_i_o_n
  662.  
  663. J            The genetic algorithm implemented by this program boils down to  the
  664.             following  steps.   (Note that a number of new terms, shown in ital-
  665.             ics, are introduced during the following steps without full explana-
  666.             tion.   These  terms  refer  to operations that are explained subse-
  667.             quently.)
  668.  
  669.  
  670.                                                G10
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.             H(1)  Generate an initial population of organisms.  The random number
  683.                  generator is seeded with the value of "Random # seed" (see sec-
  684.                  tion 3.5), and a new population of organisms is generated  each
  685.                  with  a  different  random genotype.  This happens whenever the
  686.                  "Reset Alg" command is invoked from the main menu.  The command
  687.                  also  resets  the generation counter to 0 and clears the output
  688.                  variables which are updated during  each  algorithm  run.   The
  689.                  number of organisms generated depends on the value of the _p_o_p_u_-
  690.                  _l_a_t_i_o_n input variable.
  691.  
  692. J            (2)  Calculate and scale new fitnesses.  Each new individual's  fit-
  693.                  ness  is  calculated by reading a value of f(x) from the target
  694.                  function at the individual's value of x.  If selected,  _f_i_t_n_e_s_s
  695.                  _s_c_a_l_i_n_g is now done.
  696.  
  697. J            (3)  Select individuals for breeding.  A subset of the population is
  698.                  selected for breeding.
  699.  
  700. J            (4)  Breed to produce new population.  The set of breeders are taken
  701.                  in  random  pairs  and mated to produce pairs of new organisms,
  702.                  the progeny.
  703.  
  704. J            (5)  Disperse progeny into the population.  The new progeny are  in-
  705.                  serted into the population, displacing existing individuals.
  706.  
  707. J            After the last step, the algorithm begins again at step 2,  starting
  708.             the next generation.
  709.  
  710.  
  711.             _5._4.  _S_u_m_m_a_r_y _o_f _A_l_g_o_r_i_t_h_m _I_n_p_u_t _V_a_r_i_a_b_l_e_s
  712.  
  713. J            Each input variable to the simple genetic  algorithm  is  summarised
  714.             below.
  715.  
  716.  
  717.             _5._4._1.  _P_o_p_u_l_a_t_i_o_n
  718.  
  719. J            This input variable determines the number of individuals in the  po-
  720.             pulation.   That is, the number of candidate solutions being manipu-
  721.             lated by the algorithm at any time.   Too  small  a  population  and
  722.             there  will  be  little opportunity for genetic variation, too large
  723.             and the algorithm will reduce to a random search.
  724.  
  725. J            For the problem posed in the Workbench, populations as low as  5  to
  726.             10  can  be quite effective but in more complex problems where there
  727.             are many more possible solutions larger  populations  are  required.
  728.             However, even for very complex problems, populations rarely exceed a
  729.             few hundred individuals.
  730.  
  731. J                                               G11
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.             HOne of the reasons why surprisingly small populations can be  effec-
  744.             tive  is  the  intrinsic tolerance of noise exhibited by the genetic
  745.             algorithm which arises out of the repeated sampling of small  chunks
  746.             of  the  genetic material (so called schemata) over a number of gen-
  747.             erations.
  748.  
  749. J            There is a discussion of the issues in selecting suitable population
  750.             sizes in Goldberg 1988.
  751.  
  752.  
  753.             _5._4._2.  _F_i_t_n_e_s_s _S_c_a_l_i_n_g
  754.  
  755. J            Fitness scaling occurs between the production of new individuals  in
  756.             the  population  and  the use of their fitness values for selection.
  757.             It is a method  of  adjusting  the  probability  distribution  which
  758.             determines the likelihood of an individual being selected for breed-
  759.             ing.  It is usually used to emphasise the relatively  small  differ-
  760.             ences  in  relative  fitness  when  a population begins to converge.
  761.             Without it, the rate of convergence will slow down as diversity  de-
  762.             creases   and  most  individuals  in  the  population  have  similar
  763.             fitnesses.
  764.  
  765. J            The kind of fitness scaling employed depends on  the  value  of  the
  766.             corresponding input variable which has one of the following values.
  767.  
  768. J            _N_o_n_e No scaling.  An individual's scaled fitness value is  the  same
  769.                  as its unscaled value.
  770.  
  771. J            _L_i_n_e_a_r
  772.                  Each individual's scaled fitness f' is calculated from its uns-
  773.                  caled fitness f according to the formula
  774.  
  775. J                     f' = a.f + b
  776. J
  777. J                 where a and b are chosen so that the  mean  scaled  fitness  is
  778.                  equal  to  the  mean unscaled fitness of the population, and so
  779.                  that the maximum scaled fitness is a given multiple of the max-
  780.                  imum unscaled fitness.  The multiple is typically two.
  781.  
  782. J            Several methods of fitness scaling are discussed in Goldberg 1989.
  783.  
  784.  
  785.             _5._4._3.  _B_r_e_e_d_e_r _S_e_l_e_c_t_i_o_n
  786.  
  787. J            Breeder selection involves choosing a number of individuals  accord-
  788.             ing to (scaled) fitness which will be used for breeding.
  789.  
  790.  
  791.                                                G12
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.             HThe number chosen depends on the number of new individuals required,
  804.             which  is the product of the current population size and the _g_e_n_e_r_a_-
  805.             _t_i_o_n _g_a_p.  The latter is an input variable between  0  and  1  which
  806.             represents  the proportion of the current population replaced during
  807.             each generation.
  808.  
  809. J            The method of selecting the individuals depends on the value of  the
  810.             input variable _b_r_e_e_d_e_r _s_e_l_e_c_t_i_o_n:
  811.  
  812. J            _R_o_u_l_e_t_t_e
  813.                  This method is so named because of its similarity to spinning a
  814.                  roulette  wheel.   In  effect,  an  imaginary roulette wheel is
  815.                  marked out with one slot per individual in the population,  but
  816.                  the  slots  are  of  differing  sizes giving some individuals a
  817.                  better chance of being selected for breeding than  others.   By
  818.                  making  the  slot  size proportional to the (scaled) fitness of
  819.                  each individual, the fitter individuals have a  correspondingly
  820.                  better  chance  of  being selected and passing on their charac-
  821.                  teristics.
  822.  
  823. J                 The imaginary wheel is spun once for each individual  required,
  824.                  one individual being selected per spin.  This allows some indi-
  825.                  viduals to be selected more than once  and  others  not  to  be
  826.                  selected at all.
  827.  
  828. J            _E_x_p_e_c_t_e_d _V_a_l_u_e
  829.                  There is a potential problem with roulette wheel selection  be-
  830.                  cause  it  is a stochastic process.  In other words, its random
  831.                  element allows some individuals to be selected more often  than
  832.                  their  fitness deserves (and others to be selected less often).
  833.                  Expected value selection reduces this stochastic error  by  en-
  834.                  suring  that  no  individual can be selected more than one more
  835.                  time than it deserves.  (Obviously some stochastic  error  must
  836.                  remain  because  the number of times and individual is selected
  837.                  must be an integer whereas its  "selection  merit"  is  a  real
  838.                  number).
  839.  
  840. J            Both _g_e_n_e_r_a_t_i_o_n _g_a_p and several kinds of _b_r_e_e_d_e_r _s_e_l_e_c_t_i_o_n are  dis-
  841.             cussed in Goldberg 1989.
  842.  
  843.  
  844.             _5._4._4.  _G_e_n_e_r_a_t_i_o_n _G_a_p
  845.  
  846. J            The _g_e_n_e_r_a_t_i_o_n _g_a_p input variable determines the proportion of  each
  847.             the  population replaced during each generation.  See breeder selec-
  848.             tion above.
  849.  
  850.  
  851.  
  852.  
  853.                                                G13
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.             H_5._4._5.  _M_a_t_e_s _S_e_l_e_c_t_i_o_n
  866.  
  867. J            Following selection of a pool of individuals for breeding, pairs are
  868.             taken from this pool and bred to produce a pool of progeny.  The in-
  869.             put variable _m_a_t_e_s _s_e_l_e_c_t_i_o_n determines how these pairs are  chosen.
  870.             Currently only one method is supported:
  871.  
  872. J            _R_a_n_d_o_m
  873.                  Each individual chosen for mating from  the  breeding  pool  is
  874.                  selected  at random and is immediately removed from the pool to
  875.                  prevent it being selected again.
  876.  
  877. J            In this implementation all individuals are identical and  so  purely
  878.             random  selection  of a mate is always valid.  However, more compli-
  879.             cated schemes are feasible where mating is restricted in  some  way,
  880.             perhaps  to  simulate the formation of niche populations or species.
  881.             This is discussed further in Goldberg  1989  (p188-197).   See  also
  882.             section 5.4.9 which describes dispersal by crowding.
  883.  
  884.  
  885.             _5._4._6.  _M_a_t_i_n_g
  886.  
  887. J            Having selected a pair of individuals for mating, they are mated  to
  888.             produce  new  individuals  which are collected in a pool of progeny.
  889.             The method used is determined by the value of the _m_a_t_i_n_g input vari-
  890.             able, but this currently only supports one method:
  891.  
  892. J            _S_i_m_p_l_e
  893.                  Simple mating produces two progeny from two parents as follows.
  894.                  First  a  copy of each parent is taken and _c_r_o_s_s_o_v_e_r is applied
  895.                  to produce two individuals each of which receives some  genetic
  896.                  material  from  both  parents.  Finally, _m_u_t_a_t_i_o_n is applied to
  897.                  each individual which may introduce  a  random  change  to  the
  898.                  genetic material.
  899.  
  900. J            Crossover and mutation are described in the following sections.
  901.  
  902. J            Currently only simple mating is supported, but many  variations  can
  903.             be envisaged, for example incorporating other genetic operators than
  904.             crossover and mutation.  These operators are  copied  directly  from
  905.             natural  processes and their are many other such operators, both na-
  906.             tural and man made, that can be tried.
  907.  
  908.  
  909.             _5._4._7.  _C_r_o_s_s_o_v_e_r
  910.  
  911. J            As mentioned earlier, each individual represents a  candidate  solu-
  912.             tion  to  the  problem  in  the  form of a string of zeros and ones.
  913.  
  914. J                                               G14
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.             HCrossover is a process which takes two such  strings  and  exchanges
  927.             portions  of  the  strings to produce two new strings, each of which
  928.             incorporates information from both the initial strings.  Many varia-
  929.             tions  of  the  crossover operator have been experimented with.  The
  930.             following are available according to the value of the _c_r_o_s_s_o_v_e_r  in-
  931.             put variable:
  932.  
  933. J            _S_i_n_g_l_e _P_o_i_n_t
  934.                  A point is chosen at random from the first to the last but  one
  935.                  binary  digit of one of the strings.  The digits following this
  936.                  point are exchanged between  the  two  strings.   For  example,
  937.                  given  the  two initial strings and a crossover point indicated
  938.                  by the '^'.
  939.  
  940. J                                      0   1   0   0   0   0   0
  941.                                       1   0   1   1   0   1   0
  942.                                               ^
  943. J
  944. J                 the following new strings would be produced.
  945.  
  946. J                                      0   1   0   1   0   1   0
  947.                                       1   0   1   0   0   0   0
  948.                                               ^
  949. J
  950. J            _T_w_o _P_o_i_n_t
  951.                  Two point crossover is similar except that two distinct points  are
  952.                  chosen,  again  randomly, and the segment between the two points is
  953.                  exchanged.  The operator works in such  a  way  that  single  point
  954.                  crossover  is a legal special case of two point crossover.  This is
  955.                  the case if either of the two points is  at  the  extremes  of  the
  956.                  string.
  957.  
  958. J            _U_n_i_f_o_r_m
  959.                  Uniform crossover passes  along  the  length  of  the  strings  and
  960.                  chooses  to  take  each bit from either one parent or the other ac-
  961.                  cording to some specified probability.  The origin of each  bit  is
  962.                  independent of all the other bits and in this implementation has an
  963.                  equal chance of being taken from either parent.  This produces more
  964.                  mixing of bits than the former operators.
  965.  
  966. J            The effect of crossover, whatever its form, is to produce new  individu-
  967.             als which contain genetic material from two parents.  No new material is
  968.             introduced, and so there is a limit to the genotypes that  can  be  pro-
  969.             duced throughout crossover alone.
  970.  
  971. J            Several such operators including single point and  two  point  crossover
  972.             are  described  in  Goldberg  1989.  Uniform crossover is described (and
  973.  
  974. J                                               G15
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.             Hcompared with several other crossover operators) in Syswerda 1989.
  987.  
  988.  
  989.             _5._4._8.  _M_u_t_a_t_i_o_n _P_r_o_b_a_b_i_l_i_t_y
  990.  
  991. J            Mutation involves the chance introduction of a change to any  particular
  992.             bit  of  an individual's string.  Each bit is considered in turn, and is
  993.             flipped from a zero to a one (or vice versa) with probability determined
  994.             by the value of the _m_u_t_a_t_i_o_n _p_r_o_b_a_b_i_l_i_t_y input variable.
  995.  
  996. J            Mutation can result in new genetic material being  introduced  into  the
  997.             population,  since it can produce values that were not present in either
  998.             parent, or indeed in the entire population.
  999.  
  1000. J            Typical mutation rates are of the order one in a hundred  to  one  in  a
  1001.             thousand  bits.   Much higher rates tend to disrupt the action of cross-
  1002.             over, preventing convergence and  leading  to  a  more  random  type  of
  1003.             search.
  1004.  
  1005.  
  1006.             _5._4._9.  _D_i_s_p_e_r_s_a_l
  1007.  
  1008. J            Dispersal is the method by which progeny are placed  into  the  existing
  1009.             population,  which  requires  some  existing  individuals to be deleted.
  1010.             This is done by the method indicated by the value of the _d_i_s_p_e_r_s_a_l input
  1011.             variable:
  1012.  
  1013. J            _R_a_n_d_o_m
  1014.                  Individuals are chosen at random from the existing population to be
  1015.                  replaced by progeny until all progeny have been inserted.  Measures
  1016.                  are taken to ensure that progeny inserted by the current  dispersal
  1017.                  are not displaced by the insertion of other progeny.
  1018.  
  1019. J            Crowding
  1020.                  Crowding is a mechanism used to prevent  premature  convergence  of
  1021.                  the algorithm.  The chance of an individual being displaced is made
  1022.                  to depend on the degree of similarity between it and the new  indi-
  1023.                  vidual  that is replacing it.  When a new individual is ready to be
  1024.                  placed into the existing population, it is compared (bit  for  bit)
  1025.                  with a given number of individuals chosen at random from the exist-
  1026.                  ing population.  The one most like the new individual is chosen  to
  1027.                  be  replaced.   The  number of individuals chosen for comparison is
  1028.                  determined by the value of the _c_r_o_w_d_i_n_g _f_a_c_t_o_r input variable.
  1029.  
  1030. J                 Dispersal by crowding is so called because it simulates competition
  1031.                  for  scarce  resources by individuals which are genetically similar
  1032.                  and so encourages the formation of niche populations.  Mate  selec-
  1033.                  tion, described in section 5.4.5 is another method that can be used
  1034.  
  1035.  
  1036.                                                G16
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.                  Hto encourage the formation of niche populations.  These  and  other
  1049.                  methods are discussed further in Goldberg 1989 (p188-197).
  1050.  
  1051.  
  1052.             _5._4._1_0.  _C_r_o_w_d_i_n_g _F_a_c_t_o_r
  1053.  
  1054. J            The _c_r_o_w_d_i_n_g _f_a_c_t_o_r input variable determines the number of  individuals
  1055.             that  are  compared  with each new individual during during dispersal by
  1056.             crowding (see above).  A crowding factor of  1  would  prevent  crowding
  1057.             from working and be equivalent to random dispersal.
  1058.  
  1059.  
  1060.             _5._4._1_1.  _E_l_i_t_i_s_m
  1061.  
  1062. J            Elitism is a feature that is active dependent on the value (on  or  off)
  1063.             of the _e_l_i_t_i_s_m input variable.
  1064.  
  1065. J            When active, elitism ensures that the best, or fittest, individual  can-
  1066.             not  be  lost from the population through dispersal.  A copy of the fit-
  1067.             test individual in each generation is kept and is re-introduced into the
  1068.             population  if,  after dispersal, no individual in the new population is
  1069.             at least as fit.
  1070.  
  1071. J            When elitism acts to re-introduce a lost individual it  must  choose  an
  1072.             individual  to  be  replaced.   For details of how this is done, see the
  1073.             section entitled "Sacrifice Selection" below.
  1074.  
  1075. J            Elitism is discussed in Goldberg 1989.
  1076.  
  1077.  
  1078.             _5._4._1_2.  _S_a_c_r_i_f_i_c_e _S_e_l_e_c_t_i_o_n
  1079.  
  1080. J            The method by which an individual is selected for replacement due to the
  1081.             operation of elitism (see above) is determined by the value of the input
  1082.             variable _s_a_c_r_i_f_i_c_e _s_e_l_e_c_t_i_o_n as follows:
  1083.  
  1084. J            _R_a_n_d_o_m
  1085.                  The individual to be replaced is chosen randomly.
  1086.  
  1087. J            _W_e_a_k_e_s_t
  1088.                  The weakest (i.e. least fit) individual is chosen.
  1089.  
  1090.  
  1091.             _5._5.  _O_u_t_p_u_t _v_a_r_i_a_b_l_e_s
  1092.  
  1093. J            With each generation the display of output variables is  updated.   Each
  1094.             variable is explained below:
  1095.  
  1096.  
  1097.                                                G17
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.             H_G_e_n_e_r_a_t_i_o_n
  1110.                  The number of generations (iterations  of  the  genetic  algorithm)
  1111.                  completed so far.
  1112.  
  1113. J            _O_p_t_i_m_u_m _F_i_t_n_e_s_s
  1114.                  The maximum value of the function f(x).
  1115.  
  1116. J            _C_u_r_r_e_n_t _B_e_s_t _F_i_t_n_e_s_s
  1117.                  The highest value of f(x) for any individual in the current popula-
  1118.                  tion.
  1119.  
  1120. J            _A_v_e_r_a_g_e _F_i_t_n_e_s_s
  1121.                  The average value of f(x) for all individuals in the current  popu-
  1122.                  lation.
  1123.  
  1124. J            Note that the above fitness values relate to unscaled fitnesses.
  1125.  
  1126. J            _O_p_t_i_m_u_m _x
  1127.                  The value of x which corresponds the the maximum value of  f(x)  of
  1128.                  the target function.
  1129.  
  1130. J            _C_u_r_r_e_n_t _B_e_s_t _x
  1131.                  The x of the individual in the population  which  has  the  highest
  1132.                  value for f(x).
  1133.  
  1134. J            _A_v_e_r_a_g_e _x
  1135.                  The average of all x values in the current population.
  1136.  
  1137.  
  1138.             _5._6.  _R_e_f_e_r_e_n_c_e_s
  1139.  
  1140. J            Goldberg 1988
  1141.                  Goldberg, D. E. (1988). _S_i_z_i_n_g _P_o_p_u_l_a_t_i_o_n_s _f_o_r _S_e_r_i_a_l _a_n_d  _P_a_r_a_l_l_e_l
  1142.                  _G_e_n_e_t_i_c _A_l_g_o_r_i_t_h_m_s. TCGA report no. 88005. University of Alabama.
  1143.  
  1144. J            Goldberg 1989
  1145.                  Goldberg, D. E. (1989). _G_e_n_e_t_i_c _A_l_g_o_r_i_t_h_m_s _i_n _S_e_a_r_c_h _O_p_t_i_m_i_z_a_t_i_o_n &
  1146.                  _M_a_c_h_i_n_e _L_e_a_r_n_i_n_g. Addison-Wesley.
  1147.  
  1148. J            Syswerda 1989
  1149.                  Syswerda, G.  (1989).  _U_n_i_f_o_r_m  _C_r_o_s_s_o_v_e_r  _i_n  _G_e_n_e_t_i_c  _A_l_g_o_r_i_t_h_m_s.
  1150.                  Proceedings  of the Third International Conference on Genetic Algo-
  1151.                  rithms.  Morgan Kaufman.
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.                                                G18
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.             H_6.  _A_p_p_e_n_d_i_x _B - _A _T_y_p_i_c_a_l _S_e_s_s_i_o_n _U_s_i_n_g _t_h_e _W_o_r_k_b_e_n_c_h
  1170.  
  1171. J            This appendix describes a typical session using  the  genetic  algorithm
  1172.             Workbench.
  1173.  
  1174. J            To run the Workbench program you require an IBM compatible personal com-
  1175.             puter  with  EGA  display  and Microsoft compatible mouse.  To start the
  1176.             program, make sure your mouse driver is loaded, your display is  in  EGA
  1177.             mode and type
  1178.  
  1179. J                gaw
  1180. J
  1181. J            followed by pressing the <ENTER> key.  The program does not have any
  1182.             command  line  parameters.  (See also section 3.2, "Running the Pro-
  1183.             gram".)
  1184.  
  1185. J            Check that the program display is similar to that of figure 1  shown
  1186.             earlier  in  the  manual.  If you think something is wrong, refer to
  1187.             _p_r_o_b_l_e_m_s, _a_p_p_e_n_d_i_x _C _w_h_i_c_h _d_e_s_c_r_i_b_e_s  _p_o_s_s_i_b_l_e  _p_r_o_b_l_e_m_s  _a_n_d  _t_h_e_i_r
  1188.             _s_o_l_u_t_i_o_n.
  1189.  
  1190. J            Typical use involves the following steps.
  1191.  
  1192. J            1    Click on "Enter Targ" in the menu and enter a function  extend-
  1193.                  ing from leftmost to rightmost points on the graph.  (Note that
  1194.                  clicking the left mouse button sets a point, clicking the right
  1195.                  deletes  a  point, and pressing both together ends input of the
  1196.                  function).  You should enter a function starting from the graph
  1197.                  origin  (bottom left), and finishing at the bottom right of the
  1198.                  graph.  To end entry of the  function,  press  left  and  right
  1199.                  mouse buttons simultaneously.  If you go wrong, click on "Enter
  1200.                  Targ" and try again.
  1201.  
  1202. J            2    Click on "Reset Alg" to initialise the genetic algorithm.   No-
  1203.                  tice  the  histogram  of  population distribution in the bottom
  1204.                  left hand corner is redrawn, along with the output variables in
  1205.                  the box at the bottom right corner of the screen.
  1206.  
  1207. J            3    Click on "Start Alg" which causes the algorithm to  run.   Note
  1208.                  that  the  menu  option  changes its name to "Stop Alg", and so
  1209.                  clicking on it again will pause the algorithm.
  1210.  
  1211. J            While running, a count of generations is maintained in  the  "Output
  1212.             Variables" box, along with several other algorithm variables.  Every
  1213.             so often, the histogram is updated as  the  population  attempts  to
  1214.             converge  on the value of x which corresponds to the highest peak in
  1215.  
  1216.  
  1217.                                                G19
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.             Hthe target function input earlier.
  1230.  
  1231. J            At any time, a plot of average fitness against time can be  produced
  1232.             by  clicking on "Plot Data".  The algorithm can be paused/re-started
  1233.             by clicking on "Stop Alg" and "Start Alg".  New target functions can
  1234.             be  provided, as described earlier, and the algorithm allowed to run
  1235.             with the current population distribution or with a new  distribution
  1236.             by clicking on "Reset Alg".
  1237.  
  1238. J            While the algorithm is paused,  various  program  variables  can  be
  1239.             changed  by  clicking  the mouse button while the cursor is hovering
  1240.             over the _u_p and _d_o_w_n arrows next to values displayed  in  the  large
  1241.             box  spanning the top of the screen.  Pressing and holding the mouse
  1242.             button enables variables to be changed quickly.
  1243.  
  1244. J            Note that the large box spanning the top of the screen contains  two
  1245.             pages,  only  one  of  which  is  displayed at a time.  These can be
  1246.             thumbed through by clicking on the arrows at the very top  right  of
  1247.             the display, immediately to the right of the copyright message.  The
  1248.             first page is called "Simple Genetic Algorithm" which  allows  algo-
  1249.             rithm  variables  to  be adjusted.  The second page, called "General
  1250.             Program Control Variables", allows selection of different  data  for
  1251.             plotting  on  the output graph, changes to the scale of output graph
  1252.             axes and so on.
  1253.  
  1254. J            Note that the algorithm will only run while the "Simple Genetic  Al-
  1255.             gorithm"  page  is  selected.  Alternative algorithms, simulated an-
  1256.             nealing for example, will be  implemented  by  providing  additional
  1257.             pages of algorithm variables.
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.                                                G20
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.             H_7.  _A_p_p_e_n_d_i_x _C - _P_r_o_b_l_e_m_s _a_n_d _H_o_w _t_o _F_i_x _T_h_e_m
  1293.  
  1294. J            This appendix is intended to help sort out problems encountered when
  1295.             trying to run the genetic algorithm Workbench program.
  1296.  
  1297. J            If you are unable to fix any problems using the  list  of  potential
  1298.             problems  and solutions which follow, it is wise to take the follow-
  1299.             ing steps before giving up in despair:
  1300.  
  1301. J            (1)  Prevent installation of any unnecessary resident programs  such
  1302.                  as  pop-up  utilities,  disk  caches  or  command line editors.
  1303.                  These are often installed by commands in your autoexec.bat file
  1304.                  and could be the source of your problem.
  1305.  
  1306. J            (2)  Prevent installation of any unnecessary device drivers.   These
  1307.                  are  usually installed by commands in your config.sys file such
  1308.                  as "device=filename".
  1309.  
  1310. J            The only resident program or device driver that you  will  need  in-
  1311.             stalled is your mouse driver which may be installed by either of the
  1312.             above methods depending on the software supplied with your mouse.
  1313.  
  1314.  
  1315.             _P_r_o_b_l_e_m: _D_i_s_p_l_a_y _i_s _s_q_u_a_s_h_e_d
  1316.  
  1317. J            The top third of the screen is blank, but  everything  is  displayed
  1318.             correctly  in  the lower two thirds of the screen.  The mouse cursor
  1319.             may also be missing.
  1320.  
  1321. J            Your display adapter is in the wrong mode, possibly VGA mode.  Refer
  1322.             to your display adapter manual for details of how to set it into EGA
  1323.             mode.
  1324.  
  1325.  
  1326.             _P_r_o_b_l_e_m: _D_i_s_p_l_a_y _c_o_r_r_u_p_t _o_r _b_l_a_n_k
  1327.  
  1328. J            Your display adapter is probably in the wrong mode.  Refer  to  your
  1329.             display adapter manual for details of how to set it into EGA mode.
  1330.  
  1331.  
  1332.             _P_r_o_b_l_e_m: _N_o _m_o_u_s_e _c_u_r_s_o_r
  1333.  
  1334. J            The mouse cursor is not visible but it is possible to highlight  op-
  1335.             tions in the command menu by moving the invisible cursor towards the
  1336.             menu and "circling" with the mouse.
  1337.  
  1338. J
  1339.  
  1340.                                                G21
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.             HThis probably indicates a problem with your mouse  driver.   It  may
  1353.             not be compatible with this mode of your display adapter.  Note that
  1354.             the Workbench program operates in _g_r_a_p_h_i_c_s mode, and so this problem
  1355.             may  occur  even if you have used your mouse with the display in EGA
  1356.             _c_h_a_r_a_c_t_e_r mode (which would display a block mouse cursor).
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.                                                G22
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.             H_8.  _A_p_p_e_n_d_i_x _D - _G_e_n_e_r_a_l _I_n_t_r_o_d_u_c_t_i_o_n _t_o _G_e_n_e_t_i_c _A_l_g_o_r_i_t_h_m_s
  1418.  
  1419. J            The following is an article which appeared in the Guardian newspaper
  1420.             on 14 September 1989.
  1421.  
  1422.  
  1423.             _W_h_y _N_a_t_u_r_e _K_n_o_w_s _B_e_s_t _A_b_o_u_t _D_e_s_i_g_n
  1424.  
  1425. J                 _E_n_g_i_n_e_e_r_s _n_o_w _n_e_e_d _a _h_e_l_p_i_n_g _h_a_n_d _f_r_o_m _N_a_t_u_r_e _i_n _o_r_d_e_r _t_o _s_o_l_v_e
  1426.                  _t_h_e_i_r _p_r_o_b_l_e_m_s.  _M_a_r_k _H_u_g_h_e_s _r_e_p_o_r_t_s.
  1427.  
  1428. J            All life on  earth,  including  its  most  intricate  and  ingenious
  1429.             features  is the product of a genetic algorithm, known more commonly
  1430.             as evolution.  However, genetic algorithms need not be  confined  to
  1431.             nature.  They can be used to help solve many design and optimisation
  1432.             problems.  Computer implementations of genetic algorithms are  being
  1433.             used  to  tackle difficult problems in fields as far ranging as tur-
  1434.             bine blade design, automatic integrated circuit layout, and even  in
  1435.             the training of neural networks.
  1436.  
  1437. J            All living things carry a kind of "blue-print" for  their  construc-
  1438.             tion in the DNA of each living cell.  Over a period of time, changes
  1439.             (e.g. mutations) occur to the DNA giving rise to organisms which are
  1440.             more  likely  to  survive,  and  so have a greater chance of passing
  1441.             their improved characteristics on to future generations.  Of course,
  1442.             not  all changes will be beneficial, but those which are not tend to
  1443.             die out.  This is evolution.  It is analogous  to  engineers  making
  1444.             design  changes  in  order to improve their company's product and so
  1445.             gain a competitive advantage or increase profitability.  The genetic
  1446.             algorithm is the mechanism invented by nature for trying out altera-
  1447.             tions to DNA.
  1448.  
  1449. J            In the past, evolution has been perceived as a slow  and  hap-hazard
  1450.             process, relying on random mutations, and thus unsuitable for use in
  1451.             engineering.  This perception caused problems to  scientists  trying
  1452.             to  explain  the  rapid  rate  of  evolution evident from the fossil
  1453.             record, and has been shown to be false.   Although  scientists  have
  1454.             been  aware of genetic operators other than random mutation for some
  1455.             time, it was not until the 1970s that a  mathematical  analysis  re-
  1456.             vealed their importance (Holland 1975). Holland showed that nature's
  1457.             genetic algorithm was highly efficient at search  and  optimisation,
  1458.             and in no sense hap-hazard.
  1459.  
  1460. J            In engineering, computer simulations of genetic  algorithms  can  be
  1461.             used to evolve better designs for a variety of systems.  The comput-
  1462.             er is used to maintain a population of competing designs  each  with
  1463.             its  own  computer  representation of DNA (usually a binary string).
  1464.             Here, instead of determining animal characteristics  such  as  size,
  1465.             number  of  limbs  and  eye  colour, the "DNA" is decoded to produce
  1466.  
  1467. J                                               G23
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.             Hdesign characteristics such as lengths, angles, equations or  rules.
  1480.             At  each  generation,  the better (cf. fitter) designs are chosen to
  1481.             reproduce, and operators borrowed  from  nature  are  used  to  make
  1482.             changes  to  their "DNA" in the search for improvements. The designs
  1483.             are then tested by decoding the "DNA", and over several  generations
  1484.             the  population  evolves and improves the criteria chosen by the en-
  1485.             gineer.
  1486.  
  1487. J            The freedom to select fitness criteria allows genetic algorithms  to
  1488.             be  applied  in  many  fields.   For example, you may wish to evolve
  1489.             rules for trading in financial markets, improve the aerodynamics  of
  1490.             a  vehicle,  or simply solve an abstract mathematical function.  But
  1491.             why use a genetic algorithm, when in  the  last  case  for  example,
  1492.             there  are  plenty  of  established methods for solving mathematical
  1493.             functions?
  1494.  
  1495. J            The reason is that existing methods are fine so long as the  problem
  1496.             is  not too complex.  A genetic algorithm allows extremely difficult
  1497.             functions to be solved efficiently - even the design of a living or-
  1498.             ganism.
  1499.  
  1500. J            In engineering terms, the strengths of  genetic  algorithms  can  be
  1501.             summarised  by their abilities to cope with a variety of very diffi-
  1502.             cult problems, to work without prior knowledge  about  the  function
  1503.             being  optimised,  to  optimise "noisy" functions, and to do without
  1504.             secondary information such as gradients.  In plain language they can
  1505.             cope  with  the difficulties represented by real-life problems which
  1506.             are generally insoluble by other methods.
  1507.  
  1508. J            A recent and most impressive testament to the fact that genetic  al-
  1509.             gorithms are now coming of age has been provided by General Electric
  1510.             in the USA who used the technique to design an improved gas  turbine
  1511.             blade.  Their computer model indicates efficiency improvements of 2%
  1512.             for the design, a significant saving in this  field,  and  they  are
  1513.             currently  spending  around  $1m  verifying the prediction.  If this
  1514.             succeeds they will spend $70m re-tooling their  production  line  to
  1515.             produce the new type of blade.
  1516.  
  1517. J            Applications in addition to  those  mentioned  already  include  gas
  1518.             pipeline  management,  medical  image  registration, adaptive filter
  1519.             design and mechanical structure optimisation.   But  engineering  is
  1520.             not  the only area to benefit.  Genetic algorithms have been used to
  1521.             generate rules for financial trading systems, to  classify  forensic
  1522.             evidence, and to identify insurance risks.
  1523.  
  1524. J            A lack of computer power has been a factor limiting  the  usefulness
  1525.             of  genetic  algorithms  as  they sometimes require large amounts of
  1526.             computation, particularly if complex computer models  are  involved.
  1527.             But this is no longer such a problem because computing power has be-
  1528.  
  1529. J                                               G24
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.             Hcome relatively cheap.  Even very  difficult  problems  can  now  be
  1542.             solved  because  of the efficiency with which genetic algorithms can
  1543.             be implemented on today's parallel computer architectures.
  1544.  
  1545. J            Engineering problems are getting so complex that man's intuitive ap-
  1546.             proach  to design is becoming too primitive.  Genetic algorithms are
  1547.             one of the tools that engineers are  using  to  make  up  for  their
  1548.             short-comings.
  1549.  
  1550. J            _R_e_f_e_r_e_n_c_e: _H_o_l_l_a_n_d _J. _H. (_1_9_7_5). _A_d_a_p_t_a_t_i_o_n _i_n _N_a_t_u_r_a_l  _a_n_d  _A_r_t_i_f_i_-
  1551.             _c_i_a_l _S_y_s_t_e_m_s.  _U_n_i_v. _o_f _M_i_c_h_i_g_a_n _P_r_e_s_s: _A_n_n _A_r_b_o_r, _M_I.
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.                                                G25
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.             H_9.  _A_p_p_e_n_d_i_x _E - _M_a_i_n _C_o_m_m_a_n_d _M_e_n_u
  1606.  
  1607. J            The functions of the command menu shown  in  the  top  left  of  the
  1608.             screen are as follows.
  1609.  
  1610. J                         GOption                       Function
  1611.                    HRedraw               Redraws the whole screen
  1612.                    Start Alg/Stop Alg   Start/pause algorithm operation
  1613.                    Step Alg             No function
  1614.                    Reset Alg            Generate initial random population
  1615.                    Plot Data            Plot graph of average or best fitness
  1616.                    Plot Targ            Re-plot the target function
  1617.                    Enter Targ           Enter or re-enter target function
  1618.                    Quit                 Exit the program
  1619.                    Test                 Tests my jump-up menus (no function)
  1620. J
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654. J
  1655.  
  1656.                                                G26
  1657.  
  1658.  
  1659.  
  1660.  
  1661. @
  1662.